var categoriesCtrl = $.mvc.controller.create('categories', {
    views: {
        "categories_tpl": "views/categories.tpl" 
    },
     
    default:function() {
         
        categories.fetchAll(function(all) { 

            //parent categories

            var vi = [];

            $.each(all, function(i,v) {
                if(v.parentID == 0){ 
                     vi.push(v);
                } 
            }); 

            localStorage.setItem('parent', JSON.stringify(vi));

            //child categories

            var ch = [];

            $.each(all, function(i,c) {
                if(c.parentID != 0 ){ 
                     ch.push(c);
                } 
            }); 

            localStorage.setItem('child', JSON.stringify(ch));

            // grand child categories


 
            
 
            $("#shopList").html($.template('categories_tpl', {  
                
            })); 
        }); 
          
    },
     
    init: function() {
        
    }
});